package com.oocl.daobooks.entrance;

import java.util.List;

import com.oocl.daobooks.dao.BookDao;
import com.oocl.daobooks.dao.impl.BookDaoImpl;
import com.oocl.daobooks.datagen.BookFileHandler;
import com.oocl.daobooks.pojo.Book;

public class BookMain {

	public static void main(String[] args) {
//		BookFileHandler.writeToFile("output/books.data");
		
		List<Book> bookList = BookFileHandler.readFromFile("output/books.data");
		
		long startTime = System.currentTimeMillis();
		BookDao bookDao = new BookDaoImpl();
		bookDao.clear();
		for (Book b : bookList) {
			bookDao.addBook(b);
		}
		long endTime = System.currentTimeMillis();
		System.out.println("Time cost: " + (endTime - startTime) + "ms");
	}
}
